#include "Food.h"
#include "Player.h"
#include "Game.h"
#include "ObjectDatabase.h"
#include "Renderer.h"

Food::Food(FoodType foodType) : Item(GT_IT_FOOD) {
	m_types[TH_FOOD_TYPE] = foodType;
	const FoodInfo& info = g_objectDatabase->getFoodInfo(foodType);
	m_satiation = info.satiation;
	m_weight = info.weight;
	m_stackable = true;
}

Food::Food(FoodType type, std::ifstream& file) : Item(GT_IT_FOOD, file) {
	m_types[TH_FOOD_TYPE] = type;
	const FoodInfo& info = g_objectDatabase->getFoodInfo(type);
	m_satiation = info.satiation;
	m_weight = info.weight;
	m_stackable = true;
}

Food::~Food() {
}

void Food::save(std::ofstream& file) const {
	file << getType(TH_GENERIC_TYPE) << " " << getType(TH_FOOD_TYPE) << "\n";
	Item::save(file);
}

void Food::eatEffects(Player* player) {
}

void Food::render(float x, float y) {
	g_renderer->render(*this, x, y);
}